﻿
namespace TestWeb
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Data;
    using System.Linq;
    using System.ServiceModel.DomainServices.EntityFramework;
    using System.ServiceModel.DomainServices.Hosting;
    using System.ServiceModel.DomainServices.Server;
    using GSSoftSL.Web.Models;


    // Implements application logic using the GSSoftSLEntities context.
    // TODO: Add your application logic to these methods or in additional methods.
    // TODO: Wire up authentication (Windows/ASP.NET Forms) and uncomment the following to disable anonymous access
    // Also consider adding roles to restrict access as appropriate.
    // [RequiresAuthentication]
    [EnableClientAccess()]
    public class DomainService1 : LinqToEntitiesDomainService<GSSoftSLEntities>
    {

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'BienLais' query.
        public IQueryable<BienLai> GetBienLais()
        {
            return this.ObjectContext.BienLais;
        }

        public void InsertBienLai(BienLai bienLai)
        {
            if ((bienLai.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(bienLai, EntityState.Added);
            }
            else
            {
                this.ObjectContext.BienLais.AddObject(bienLai);
            }
        }

        public void UpdateBienLai(BienLai currentBienLai)
        {
            this.ObjectContext.BienLais.AttachAsModified(currentBienLai, this.ChangeSet.GetOriginal(currentBienLai));
        }

        public void DeleteBienLai(BienLai bienLai)
        {
            if ((bienLai.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(bienLai, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.BienLais.Attach(bienLai);
                this.ObjectContext.BienLais.DeleteObject(bienLai);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'BienLaiCTs' query.
        public IQueryable<BienLaiCT> GetBienLaiCTs()
        {
            return this.ObjectContext.BienLaiCTs;
        }

        public void InsertBienLaiCT(BienLaiCT bienLaiCT)
        {
            if ((bienLaiCT.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(bienLaiCT, EntityState.Added);
            }
            else
            {
                this.ObjectContext.BienLaiCTs.AddObject(bienLaiCT);
            }
        }

        public void UpdateBienLaiCT(BienLaiCT currentBienLaiCT)
        {
            this.ObjectContext.BienLaiCTs.AttachAsModified(currentBienLaiCT, this.ChangeSet.GetOriginal(currentBienLaiCT));
        }

        public void DeleteBienLaiCT(BienLaiCT bienLaiCT)
        {
            if ((bienLaiCT.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(bienLaiCT, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.BienLaiCTs.Attach(bienLaiCT);
                this.ObjectContext.BienLaiCTs.DeleteObject(bienLaiCT);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'DiemDanhs' query.
        public IQueryable<DiemDanh> GetDiemDanhs()
        {
            return this.ObjectContext.DiemDanhs;
        }

        public void InsertDiemDanh(DiemDanh diemDanh)
        {
            if ((diemDanh.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(diemDanh, EntityState.Added);
            }
            else
            {
                this.ObjectContext.DiemDanhs.AddObject(diemDanh);
            }
        }

        public void UpdateDiemDanh(DiemDanh currentDiemDanh)
        {
            this.ObjectContext.DiemDanhs.AttachAsModified(currentDiemDanh, this.ChangeSet.GetOriginal(currentDiemDanh));
        }

        public void DeleteDiemDanh(DiemDanh diemDanh)
        {
            if ((diemDanh.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(diemDanh, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.DiemDanhs.Attach(diemDanh);
                this.ObjectContext.DiemDanhs.DeleteObject(diemDanh);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'DiemDanhCTs' query.
        public IQueryable<DiemDanhCT> GetDiemDanhCTs()
        {
            return this.ObjectContext.DiemDanhCTs;
        }

        public void InsertDiemDanhCT(DiemDanhCT diemDanhCT)
        {
            if ((diemDanhCT.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(diemDanhCT, EntityState.Added);
            }
            else
            {
                this.ObjectContext.DiemDanhCTs.AddObject(diemDanhCT);
            }
        }

        public void UpdateDiemDanhCT(DiemDanhCT currentDiemDanhCT)
        {
            this.ObjectContext.DiemDanhCTs.AttachAsModified(currentDiemDanhCT, this.ChangeSet.GetOriginal(currentDiemDanhCT));
        }

        public void DeleteDiemDanhCT(DiemDanhCT diemDanhCT)
        {
            if ((diemDanhCT.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(diemDanhCT, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.DiemDanhCTs.Attach(diemDanhCT);
                this.ObjectContext.DiemDanhCTs.DeleteObject(diemDanhCT);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'GiaoViens' query.
        public IQueryable<GiaoVien> GetGiaoViens()
        {
            return this.ObjectContext.GiaoViens;
        }

        public void InsertGiaoVien(GiaoVien giaoVien)
        {
            if ((giaoVien.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(giaoVien, EntityState.Added);
            }
            else
            {
                this.ObjectContext.GiaoViens.AddObject(giaoVien);
            }
        }

        public void UpdateGiaoVien(GiaoVien currentGiaoVien)
        {
            this.ObjectContext.GiaoViens.AttachAsModified(currentGiaoVien, this.ChangeSet.GetOriginal(currentGiaoVien));
        }

        public void DeleteGiaoVien(GiaoVien giaoVien)
        {
            if ((giaoVien.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(giaoVien, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.GiaoViens.Attach(giaoVien);
                this.ObjectContext.GiaoViens.DeleteObject(giaoVien);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'GiaoVienMons' query.
        public IQueryable<GiaoVienMon> GetGiaoVienMons()
        {
            return this.ObjectContext.GiaoVienMons;
        }

        public void InsertGiaoVienMon(GiaoVienMon giaoVienMon)
        {
            if ((giaoVienMon.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(giaoVienMon, EntityState.Added);
            }
            else
            {
                this.ObjectContext.GiaoVienMons.AddObject(giaoVienMon);
            }
        }

        public void UpdateGiaoVienMon(GiaoVienMon currentGiaoVienMon)
        {
            this.ObjectContext.GiaoVienMons.AttachAsModified(currentGiaoVienMon, this.ChangeSet.GetOriginal(currentGiaoVienMon));
        }

        public void DeleteGiaoVienMon(GiaoVienMon giaoVienMon)
        {
            if ((giaoVienMon.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(giaoVienMon, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.GiaoVienMons.Attach(giaoVienMon);
                this.ObjectContext.GiaoVienMons.DeleteObject(giaoVienMon);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'HocViens' query.
        public IQueryable<HocVien> GetHocViens()
        {
            return this.ObjectContext.HocViens;
        }

        public void InsertHocVien(HocVien hocVien)
        {
            if ((hocVien.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(hocVien, EntityState.Added);
            }
            else
            {
                this.ObjectContext.HocViens.AddObject(hocVien);
            }
        }

        public void UpdateHocVien(HocVien currentHocVien)
        {
            this.ObjectContext.HocViens.AttachAsModified(currentHocVien, this.ChangeSet.GetOriginal(currentHocVien));
        }

        public void DeleteHocVien(HocVien hocVien)
        {
            if ((hocVien.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(hocVien, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.HocViens.Attach(hocVien);
                this.ObjectContext.HocViens.DeleteObject(hocVien);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'KhoaHocs' query.
        public IQueryable<KhoaHoc> GetKhoaHocs()
        {
            return this.ObjectContext.KhoaHocs;
        }

        public void InsertKhoaHoc(KhoaHoc khoaHoc)
        {
            if ((khoaHoc.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(khoaHoc, EntityState.Added);
            }
            else
            {
                this.ObjectContext.KhoaHocs.AddObject(khoaHoc);
            }
        }

        public void UpdateKhoaHoc(KhoaHoc currentKhoaHoc)
        {
            this.ObjectContext.KhoaHocs.AttachAsModified(currentKhoaHoc, this.ChangeSet.GetOriginal(currentKhoaHoc));
        }

        public void DeleteKhoaHoc(KhoaHoc khoaHoc)
        {
            if ((khoaHoc.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(khoaHoc, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.KhoaHocs.Attach(khoaHoc);
                this.ObjectContext.KhoaHocs.DeleteObject(khoaHoc);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Lops' query.
        public IQueryable<Lop> GetLops()
        {
            return this.ObjectContext.Lops;
        }

        public void InsertLop(Lop lop)
        {
            if ((lop.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(lop, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Lops.AddObject(lop);
            }
        }

        public void UpdateLop(Lop currentLop)
        {
            this.ObjectContext.Lops.AttachAsModified(currentLop, this.ChangeSet.GetOriginal(currentLop));
        }

        public void DeleteLop(Lop lop)
        {
            if ((lop.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(lop, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Lops.Attach(lop);
                this.ObjectContext.Lops.DeleteObject(lop);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'LopCotDiems' query.
        public IQueryable<LopCotDiem> GetLopCotDiems()
        {
            return this.ObjectContext.LopCotDiems;
        }

        public void InsertLopCotDiem(LopCotDiem lopCotDiem)
        {
            if ((lopCotDiem.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(lopCotDiem, EntityState.Added);
            }
            else
            {
                this.ObjectContext.LopCotDiems.AddObject(lopCotDiem);
            }
        }

        public void UpdateLopCotDiem(LopCotDiem currentLopCotDiem)
        {
            this.ObjectContext.LopCotDiems.AttachAsModified(currentLopCotDiem, this.ChangeSet.GetOriginal(currentLopCotDiem));
        }

        public void DeleteLopCotDiem(LopCotDiem lopCotDiem)
        {
            if ((lopCotDiem.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(lopCotDiem, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.LopCotDiems.Attach(lopCotDiem);
                this.ObjectContext.LopCotDiems.DeleteObject(lopCotDiem);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'LopChiTiets' query.
        public IQueryable<LopChiTiet> GetLopChiTiets()
        {
            return this.ObjectContext.LopChiTiets;
        }

        public void InsertLopChiTiet(LopChiTiet lopChiTiet)
        {
            if ((lopChiTiet.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(lopChiTiet, EntityState.Added);
            }
            else
            {
                this.ObjectContext.LopChiTiets.AddObject(lopChiTiet);
            }
        }

        public void UpdateLopChiTiet(LopChiTiet currentLopChiTiet)
        {
            this.ObjectContext.LopChiTiets.AttachAsModified(currentLopChiTiet, this.ChangeSet.GetOriginal(currentLopChiTiet));
        }

        public void DeleteLopChiTiet(LopChiTiet lopChiTiet)
        {
            if ((lopChiTiet.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(lopChiTiet, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.LopChiTiets.Attach(lopChiTiet);
                this.ObjectContext.LopChiTiets.DeleteObject(lopChiTiet);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'LopDiems' query.
        public IQueryable<LopDiem> GetLopDiems()
        {
            return this.ObjectContext.LopDiems;
        }

        public void InsertLopDiem(LopDiem lopDiem)
        {
            if ((lopDiem.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(lopDiem, EntityState.Added);
            }
            else
            {
                this.ObjectContext.LopDiems.AddObject(lopDiem);
            }
        }

        public void UpdateLopDiem(LopDiem currentLopDiem)
        {
            this.ObjectContext.LopDiems.AttachAsModified(currentLopDiem, this.ChangeSet.GetOriginal(currentLopDiem));
        }

        public void DeleteLopDiem(LopDiem lopDiem)
        {
            if ((lopDiem.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(lopDiem, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.LopDiems.Attach(lopDiem);
                this.ObjectContext.LopDiems.DeleteObject(lopDiem);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'LopHocViens' query.
        public IQueryable<LopHocVien> GetLopHocViens()
        {
            return this.ObjectContext.LopHocViens;
        }

        public void InsertLopHocVien(LopHocVien lopHocVien)
        {
            if ((lopHocVien.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(lopHocVien, EntityState.Added);
            }
            else
            {
                this.ObjectContext.LopHocViens.AddObject(lopHocVien);
            }
        }

        public void UpdateLopHocVien(LopHocVien currentLopHocVien)
        {
            this.ObjectContext.LopHocViens.AttachAsModified(currentLopHocVien, this.ChangeSet.GetOriginal(currentLopHocVien));
        }

        public void DeleteLopHocVien(LopHocVien lopHocVien)
        {
            if ((lopHocVien.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(lopHocVien, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.LopHocViens.Attach(lopHocVien);
                this.ObjectContext.LopHocViens.DeleteObject(lopHocVien);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Mons' query.
        public IQueryable<Mon> GetMons()
        {
            return this.ObjectContext.Mons;
        }

        public void InsertMon(Mon mon)
        {
            if ((mon.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(mon, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Mons.AddObject(mon);
            }
        }

        public void UpdateMon(Mon currentMon)
        {
            this.ObjectContext.Mons.AttachAsModified(currentMon, this.ChangeSet.GetOriginal(currentMon));
        }

        public void DeleteMon(Mon mon)
        {
            if ((mon.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(mon, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Mons.Attach(mon);
                this.ObjectContext.Mons.DeleteObject(mon);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Phongs' query.
        public IQueryable<Phong> GetPhongs()
        {
            return this.ObjectContext.Phongs;
        }

        public void InsertPhong(Phong phong)
        {
            if ((phong.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(phong, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Phongs.AddObject(phong);
            }
        }

        public void UpdatePhong(Phong currentPhong)
        {
            this.ObjectContext.Phongs.AttachAsModified(currentPhong, this.ChangeSet.GetOriginal(currentPhong));
        }

        public void DeletePhong(Phong phong)
        {
            if ((phong.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(phong, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Phongs.Attach(phong);
                this.ObjectContext.Phongs.DeleteObject(phong);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Truongs' query.
        public IQueryable<Truong> GetTruongs()
        {
            return this.ObjectContext.Truongs;
        }

        public void InsertTruong(Truong truong)
        {
            if ((truong.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(truong, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Truongs.AddObject(truong);
            }
        }

        public void UpdateTruong(Truong currentTruong)
        {
            this.ObjectContext.Truongs.AttachAsModified(currentTruong, this.ChangeSet.GetOriginal(currentTruong));
        }

        public void DeleteTruong(Truong truong)
        {
            if ((truong.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(truong, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.Truongs.Attach(truong);
                this.ObjectContext.Truongs.DeleteObject(truong);
            }
        }
    }
}


